﻿<?php

require("funcao.php");
require("conexao.php");

// Descobre se o usuário está ou não logado
	if (!isset($_SESSION["user"]["LOGIN"]) and !isset($_SESSION["user"]["SENHA"]))
	{
print "<script type= 'text/javascript'> location.href = 'index.php?link=7'</script>";
	}else{
// Grava o ID da conta que está sendo utilizada pelo usuário
$idusuario = $_SESSION["user"]["ID"];
$sql = mysql_query("select * from conta where idusuario = $idusuario");
$coluna = mysql_fetch_array($sql);
$id = $coluna["idconta"];

}	
?>

<?php startblock('title') ?>

<title>Navegação em abas</title>
<link rel="stylesheet" type="text/css" href="resources/css/estilo.css" />

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-spin.js"></script>

<!-- PIROBOX -->
<script type="text/javascript" src="js/piroBox.js"></script>

<!-- CALENDARIO -->
 <!--<link href="resources/css/default.css" rel="stylesheet" type="text/css"/>-->
<link href="resources/css/jquery.click-calendario-1.0.css" rel="stylesheet" type="text/css"/> 
<script type="text/javascript" src="js/jquery.click-calendario-1.0-min.js"></script>		
<script type="text/javascript" src="js/exemplo-calendario.js"></script>

<script type="text/javascript" src="js/javascript.js"></script>

<!-- SPIN BUTTON -->
<script type="text/javascript" src="js/spin-button.js"></script>

<!-- DATA TABLES -->
<script src="js/jquery.DataTables.min.js" type="text/javascript"></script>
<script src="js/jquery.jeditable.js" type="text/javascript"></script>
<script src="js/jquery.jpaging.js" type="text/javascript"></script>
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/jquery.DataTables.editable.js" type="text/javascript"></script>
<!-- DATATABLES -->
<!-- DIALOG -->
<script src="js/plugins/dialog/jquery.ui.core.js"></script>
<script src="js/plugins/dialog/jquery.ui.widget.js"></script>
<script src="js/plugins/dialog/jquery.ui.mouse.js"></script>
<script src="js/plugins/dialog/jquery.ui.button.js"></script>
<script src="js/plugins/dialog/jquery.ui.draggable.js"></script>
<script src="js/plugins/dialog/jquery.ui.position.js"></script>
<script src="js/plugins/dialog/jquery.ui.resizable.js"></script>
<script src="js/plugins/dialog/jquery.ui.dialog.js"></script>
<script src="js/plugins/dialog/jquery.effects.core.js"></script>
<!-- DIALOG -->	
<!-- Uploadify -->
<link href="uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="uploadify/swfobject.js"></script>
<script type="text/javascript" src="uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<!-- Uploadify -->

<!-- NOTIFICACAO -->
<script src="js/jquery.jgrowl.js"></script>

<script type="text/javascript">

$(document).ready(function(){

	$('.thumbs').piroBox({
			border: 10,
			borderColor : '#222', 
			mySpeed: 700,  
			bg_alpha: 0.3,
			cap_op_start : 0.4,
			cap_op_end: 0.8,
			pathLoader : '#000 url(../../imagens/ajax-loader.gif) center center no-repeat;', 
			gallery : '.gallery_in li a', 
			gallery_li : '.gallery_in li', 
			next_class : '.next_in',
			previous_class : '.previous_in'
	});	

	$("#tbcontas").dataTable({
        "oLanguage": {
            "sLengthMenu": "Mostrar _MENU_ linhas por página",
            "sZeroRecords": "Nenhum dado encontrado",
            "sInfo": "Mostrando _START_ a _END_ de _TOTAL_ linhas",
            "sInfoEmpty": "Mostrando 0 a 0 de 0 linhas",
            "sInfoFiltered": "( de um total de _MAX_ linhas)",
			"sEmptyTable": "Nenhum dado a ser mostrado",
			"sSearch": "Buscar:"
			}
        }).makeEditable({
									sAddURL: "AddData.php",
									sUpdateURL: "UpdateData.php",
                    				sDeleteURL: "DeleteData.php"
							});								
							
							
	new Autocomplete("txt_idclassificacao", function() {
		this.setValue = function( id, estado, sigla ) {
			$("#id_val").val(id);
			$("#estado_val").val(estado);
			$("#sigla_val").val(sigla);
		}
		if ( this.isModified )
			this.setValue("");
		if ( this.value.length < 1 && this.isNotClick ) 
			return ;
		return "autocp.php?q=" + this.value;
	});
});
</script>


<?php endblock() ?>



<body>
<div class="global-div">


<ul class="abas">
    <li><a href="#noticia1">Contas a Pagar e Receber</a></li>
    <li><a href="#noticia2">Cadastrar Novo</a></li>
</ul>

<div id="ajuda">
<a href="#"><img src="imagens/ajuda.png" width="30" height="30" onClick="$('#two').jGrowl('Nesta tela você porá realizar sua conciliação bancária.'); return false;"  border="0" value="Bottom Left"/></a>
<div id="two" class="jGrowl bottom-left"></div>
</div>


<div id="noticia"></div>
<div id="conteudo" >

    <div id="noticia1" >
    <form id="formulario" name="formulario" method="post" onSubmit="return validar();" enctype="multipart/form-data" action="">
      <p></p>
      <p>Data:
        <input type="text" name="data_1" id="data_1" size="10" maxlength="10"/>
        <input type="text" name="data_2" id="data_2" size="10" maxlength="10"/>
      </p>
      <div id="geral" >            
    
    <hr />      
			<div id="tab-contas">
	   <?php cTabela() ?>	
		<div class="add_delete_toolbar" /> 
			</div>      
      </div>
    </div>    
      <p>
        <input type="submit" name="grafico" id="grafico" value="Gerar Grafico" />
        <input type="submit" name="relatorio" id="relatorio" value="Gerar Relatório" />
      </p>

      <p>Total de Receitas:
<!--<input type="text" id="up3" name="up3" />-->
<!--<input type="text" id="up3" name="up3" />-->
      </p>
      <p>Total de Despesas:
        <!--<input type="text" id="up4" name="up4" /></p>-->
         </form>
      </div>
       
<div id="noticia2" class="ui-widget ui-widget-content">
<form id="form2" name="form2" method="post" enctype="multipart/form-data" action="index2.php?link=11">
        <p>Conta Nº:<select name = "idconta" id="idconta">
            <?php
			
			$sql = "select * from conta where idusuario = $idusuario";
			$qr = mysql_query($sql) or die(mysql_error());
			
			 while ($ln = mysql_fetch_assoc($qr)){
			 echo '<option value="'.$ln['idconta'].'">'.$ln['numero_conta'].'</option>';
			 }
			?>
          </select></p>
        <p>Data de Vencimento:
          <input type="text" name="data_2" id="data_2" size="10" maxlength="10"/>
        </p>
            <p>Tipo:
          <label>
          <select name="txt_tipo" id="txt_tipo">
           <option value="Saldo">Saldo</option>
           <option value="Débito">Débito</option>
          </select>
          </label>
</p>
        <p> Observação:      </p>
  <p> <textarea name="txt_descricao" cols="30" rows="3";></textarea></p>
      
      <p>Situação:
          <label>
          
          <select name="txt_situacao" id="txt_situacao">
          <option value=""></option>
          <option value="Pago">Pago Parcial</option>
          <option value="Agendado">Agendado</option>
          </select>
          </label>
      </p>
      </br>
      <p>Descrição:
          <label>
		 <input type="text" name="txt_idclassificacao" id="txt_idclassificacao" />
         <!-- <select name = "txt_idclassificacao" id="txt_idclassificacao"> --> 
              <?php 
		 /*$sql_cat = "select * from classificacao order by descricao";
		  $result = mysql_query($sql_cat);
		  
		 while ($registro = mysql_fetch_array($result))
		 {
		 $valor = $registro["idclassificacao"];

		  if ($idclassificacao == $valor)
		  $selecionado = "selected";
		  else
		  $selecionado = "";
		  
		  print "<option value = \"$valor\" $selecionado > $registro[descricao] </option>";
		  } 
		  */
		  ?>
           <!-- </select> -->
              </label>
      </p>
      </br>
      <p>
        <label>
        <input type="checkbox" name="check-repetir" onClick="document.getElementById('txt_dias').disabled = !this.checked;">
        </label>
        Repetir:
        
        <select name="txt_dias" id="txt_dias" disabled="disabled">
          <option value="1">Diário</option>
          <option value="15">Quinzenal</option>
          <option value="30">Mensal</option>
        </select>
        
        
        <input type="input" name="txt_repetir" id="spin1" value="1"  />
      </p>
      <p>Valor: 
        <input type="input" name="txt_valor" id="spin5" value="0.00" />
      </p>
      
      
      <p>Comprovante:
        <input name="comprovante" type="file" id="comprovante" />
      </p>
      <p>
        <input name="id" type="hidden" value="<?php echo $id; ?>" />
        <input name="acao" type="hidden" value="<?php echo "cadastrar"; ?>" />
        <input type="submit" name="cadastrar" id="cadastrar" value="Cadastrar" />
        <input type="reset" name="apagar tudo" id="apagar tudo" value="Limpar Campos" />
      </form>
    </div>
</div> 
   
</div>
</div>
</body>
</html>